package com.yeban.javase.day09.test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/18
 *
 * //将字符串中的数值 String str="9 10 12  6  8 15"; 进行排序
 */
public class test03 {

    public static void main(String[] args) {
        String str = "9 10 12  6  8 15";
        String[] s = str.split("\\s+");
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < s.length; i++) {
            list.add(Integer.parseInt(s[i]));
        }
        System.out.println("原来集合：" + list);
        Collections.sort(list);
        System.out.println("排序后集合：" + list);

    }
}
